package org.dnd.rcp.editor.actions;

import org.dnd.rcp.editor.text.IActionsID;
import org.dnd.rcp.editor.text.TextSource;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IEditorPart;

/**
 * Cut Action
 * 
 * @author dendy
 * 
 */
public class CutTextAction extends Action {

	private TextSource textSource;

	public CutTextAction() {
		setId(IActionsID.CUT_ID);
	}

	public void setEditor(IEditorPart newEditor) {
		if (newEditor instanceof TextSource)
			textSource = (TextSource) newEditor;
		else
			textSource = null;
	}

	public void run() {
		textSource.getText().cut();
	}
}
